/*************************************************************************
	> File Name: fun.c
	> Author: yas
	> Mail: rage_yas@hotmail.com
	> Created Time: Wed 14 May 2025 07:58:57 PM CST
 ************************************************************************/
#include <stdio.h>
void printCalendar(void)
{
    puts("Sun Mon Tue Wed Thu Fri Sat");
}

int isLeapYear(int year)
{
    if(0 == year % 4 && 0 != year % 100 || 0 == year % 400)
    {
        return 1;
    }
    else
    {
        return -1;
    }
}

int daysOfTheMonth(int year,int month)
{
    int x = isLeapYear(year),days;
    if(1 == month || 3 == month || 5 == month || 7 == month || 8 == month || 10 == month || 12 == month)
    {
        days = 31;
    }
    else if(4 == month || 6 == month || 9 == month || 11 == month)
    {
        days = 30;
    }
    else if(1 == x && 2 == month)
    {
        days = 29;
    }
    else
    {
        days = 28;
    }
    return days;
}

int daysAfter1900(int year,int month)
{
    int sum = 0,i,j;
    for(i = 1900;i < year;++i)
    {
        int t = isLeapYear(i);
        if(t == 1)
        {
            sum += 366;
        }
        else
        {
            sum += 365;
        }
    }
    if(month > 1)
    {
        for(j = 1;j < month;++j)
        {
            sum += daysOfTheMonth(year,j);
        }
    }
    return sum;
}

int weekOfTheeFirstDay(int year,int month)
{
    int days = daysAfter1900(year,month);
    int week = (days + 1) % 7;

    return week;
}